// pages/wxRequestHttp请求/wxRequestHttp请求.js
// const desUtil = require('../../utils/desUtil.js');
//gmall-prod.atguigu.cn
Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:'',
    pwd:''
  },
  loginClick(event){
      wx.showLoading({
        title: '请求加载',
        //true防止触摸屏幕
        mask:true
      })
    wx.request({
      url: 'https://news-at.zhihu.com/api/3/stories/latest',
      method:'GET',
      data:{},//请求参数
      header:{
      },
      success:(res)=>{
        console.log('success=',res)
        this.setData({
            name:JSON.stringify(res.data)
        })
      },
      fail:(res)=>{
          console.log('fail=',res)
      },
      //成功失败都会走
      complete:()=>{
        console.log('请求结束')
         wx.hideLoading()
      }
    })
  }
})